package com.gs.api.project.video.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gs.api.core.Result;
import com.gs.api.project.video.entity.BzBaseinfo;
import com.gs.api.project.video.entity.BzConfig;
import com.gs.api.util.video.parse.ParseUtil;
import com.gs.api.util.video.parse.douyin.DouyinApp;
import com.gs.api.util.video.parse.huoshan.HuoshanApp;
import com.gs.api.util.video.parse.kuaishou.KuaishouApp;
import com.gs.api.util.video.parse.pipixia.PiPiXiaApp;
import com.gs.api.util.video.parse.toutiao.ToutiaoApp;
import com.gs.api.util.video.parse.vo.VideoVo;
import com.gs.api.util.video.parse.weishi.WeishiApp;
import com.gs.api.util.video.parse.zuiyou.ZuiyouApp;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author guoyunfei on 2022/4/14 16:15
 * @className VideoService
 * @description TODO
 * @Version 1.0
 */

@Service
public class VideoService {


    /**
     * 获取视频，图集信息
     * @param vv
     * @return
     * @throws IOException
     */
    public VideoVo getVideoVoInfo(VideoVo vv) throws IOException {

        String url = vv.getUrl();

        if (url.contains("douyin.com")){
           return DouyinApp.douYinParseUrl(ParseUtil.filterUrl(url));
        }
        if (url.contains("kuaishou.com")){
            return KuaishouApp.kuaiShouParseUrl(ParseUtil.filterUrl(url));
        }
        if (url.contains("weishi.qq.com") || url.contains("weishi.qq.com")){
            return WeishiApp.weishiParseUrl(url);
        }
        if (url.contains("huoshan.com")){
            return HuoshanApp.huoShanParseUrl(ParseUtil.filterUrl(url));
        }
        if (url.contains("toutiao.com")){
            System.out.println(ToutiaoApp.getToutiaoUrl("v0301fg10000c79rldrc77u6kr12dcvg"));
            ToutiaoApp.toutiaoParseUrl(ParseUtil.filterUrl(url));
            return null;
        }
        if (url.contains("pipix.com")) {
            return PiPiXiaApp.pipixiaParseUrl(ParseUtil.filterUrl(url));
        }
        if (url.contains("izuiyou.com") || url.contains("xiaochuankeji.cn")) {
            // 最右app
            return ZuiyouApp.zuiyouParseUrl(ParseUtil.filterUrl(url));
        }

        return null;
    }

}
